﻿using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using QuickUIT.Controls;

namespace QuickUIT.Tests
{
    [TestClass]
    public class UICustomTests
    {
        private BaseState _baseState;

        [TestInitialize]
        public void TestSetup()
        {
            _baseState = new BaseState(TestUtilities.GetTestApplicationFileName(), "@Name='QuickUIT Test Application'");
            _baseState.Execute();
        }

        [TestMethod]
        public void ShouldGetCustomControl()
        {
            var window = new UIWindow("@Name='QuickUIT Test Application'");
            UICustom customControl = window.UICustom("@AutomationId='datePicker1'");
            Assert.IsNotNull(customControl);
        }

        [TestMethod]
        public void ShouldGetAllCustomControls()
        {
            var window = new UIWindow("@Name='QuickUIT Test Application'");
            List<UICustom> customControls = window.UICustoms();
            Assert.AreEqual(31, customControls.Count);
        }

        [TestCleanup]
        public void TestTeardown()
        {
            _baseState.Cleanup();
        }
    }
}